package com.nbjtjc.safe.api.edu;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nbjtjc.safe.annotation.SysLog;
import com.nbjtjc.safe.api.AbstractController;
import com.nbjtjc.safe.bean.Page;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.mapper.edu.EduUserMapper;
import com.nbjtjc.safe.mapper.emg.EmgGroupMemberMapper;
import com.nbjtjc.safe.model.edu.EduUser;
import com.nbjtjc.safe.model.emg.EmgDuty;
import com.nbjtjc.safe.model.emg.EmgGroupMember;
import com.nbjtjc.safe.model.sys.SysUser;
import com.nbjtjc.safe.service.edu.EduUserService;
import com.nbjtjc.safe.service.emg.EmgGroupMemberService;

@RestController
@CrossOrigin("*")
@RequestMapping("/eduUser")
public class EduUserController{
	@Autowired
	private EduUserService eduUserService;


	  @RequestMapping(value = "/addOrUpdate",method = {RequestMethod.POST})
	  @SysLog("添加或更新员工名单中的人员")
	    public Result add(@RequestBody EduUser eduUser){
	        Result result=new Result();
	        try {
	            result=eduUserService.add(eduUser);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }

	  
	  @RequestMapping(value = "/delete",method = {RequestMethod.POST})
	  @SysLog("删除员工名单中的人员")
	    public Result delete(@RequestBody EduUser eduUser) {
	        Result result=new Result();
	        try {
	            result=eduUserService.delete(eduUser.getId());
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }
	 
	  @RequestMapping(value = "/find", method = {RequestMethod.POST})
	  public Result find(@RequestBody EduUser eduUser) {
	        Result result = new Result();

	        try {
	            result = eduUserService.find(eduUser);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }
}
